<template>
  <div>
    <el-table :data="tableData">
      <el-table-column prop="blogId" label="ID" width="140"></el-table-column>
      <el-table-column prop="title" label="标题" width="120"></el-table-column>
      <el-table-column prop="username" label="作者"></el-table-column>
      <el-table-column prop="content" label="内容"></el-table-column>
    </el-table>
  </div>
</template>

<script>
import { getBlogList } from '@/api'
export default {
  data() {
    const item = {
      date: '2016-05-02',
      name: '王小虎',
      address: '上海市普陀区金沙江路 1518 弄',
    }
    return {
      tableData: Array(20).fill(item),
    }
  },
  created() {
    this.fetchBlogs()
  },
  methods: {
    async fetchBlogs() {
      const res = await getBlogList()
      console.log('res:', res.data.data)
      this.tableData = res.data.data
    },
  },
}
</script>

<style></style>
